package com.zp.observer;/**
 * @description
 * @author zp
 * @created 2021/9/3 23:42
 */

import java.util.ArrayList;
import java.util.List;

/**
 * @author zp
 * @description
 * @created 2021/9/3 23:42
 */
public class Subject {
    private List<Observer> observers = new ArrayList<Observer>();
    public void addObserver(Observer observer){
        observers.add(observer);
    }

    public void updateAllObserver(){
        for(Observer observer:observers){
            observer.update();
        }
    }
}
